package com.helloblog.dao.impl;

import java.sql.SQLException;

import org.apache.commons.dbutils.QueryRunner;

import com.helloblog.domain.Blog;
import com.helloblog.exception.UserDaoException;

import static com.helloblog.utils.DateSourceUtils.*;
public class BlogDaoImpl {
	public void openBlog(Blog blog){
		try {
			QueryRunner qr = new QueryRunner(getDataSource());
			String sql = "insert into blog(id,blog_name,blog_description,user_id) values(?,?,?,?)";
			Object params[] = {blog.getBlog_id(),blog.getBlog_name(),blog.getBlog_description(),blog.getUser_id()};
			qr.update(sql, params);
		} catch (Exception e) {
			throw new UserDaoException(e);
		}
	}
}
